#include <stdio.h>
#include<string.h>
void reverse(char* left, char* right) {
    while (left < right) {
        char t;
        t = *left;
        *left = *right;
        *right = t;
        left++;
        right--;
    }
}
int main() {
    char arr[100];
    gets(arr);
    char* left = arr;
    char* right = arr + strlen(arr) - 1;
    //倒置全部字符串
    reverse(left, right);
    //倒序每个单词
    char* p = arr;
    char* start = arr;
    char t;
    while (*p != '\0') 
    {
        while (*p != ' ' && *p != '\0') 
        {
            p++;
        }
        reverse(start, p - 1);
        start=p+1;
        p++;
    }
    printf("%s",arr);
    return 0;
}